

<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
  <meta charset="utf-8" />
  <meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />

  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  
  <title>Container Operations &mdash; Ceph Documentation</title>
  

  
  <link rel="stylesheet" href="../../../_static/ceph.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/ceph.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/graphviz.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/css/custom.css" type="text/css" />

  
  

  
  

  

  
  <!--[if lt IE 9]>
    <script src="../../../_static/js/html5shiv.min.js"></script>
  <![endif]-->
  
    
      <script type="text/javascript" id="documentation_options" data-url_root="../../../" src="../../../_static/documentation_options.js"></script>
        <script src="../../../_static/jquery.js"></script>
        <script src="../../../_static/_sphinx_javascript_frameworks_compat.js"></script>
        <script data-url_root="../../../" id="documentation_options" src="../../../_static/documentation_options.js"></script>
        <script src="../../../_static/doctools.js"></script>
        <script src="../../../_static/sphinx_highlight.js"></script>
    
    <script type="text/javascript" src="../../../_static/js/theme.js"></script>

    
    <link rel="index" title="Index" href="../../../genindex/" />
    <link rel="search" title="Search" href="../../../search/" />
    <link rel="next" title="对象操作" href="../objectops/" />
    <link rel="prev" title="Service Operations" href="../serviceops/" /> 
</head>

<body class="wy-body-for-nav">

   
  <header class="top-bar">
    <div role="navigation" aria-label="Page navigation">
  <ul class="wy-breadcrumbs">
      <li><a href="../../../" class="icon icon-home" aria-label="Home"></a></li>
          <li class="breadcrumb-item"><a href="../../">Ceph 对象网关</a></li>
          <li class="breadcrumb-item"><a href="../">Ceph 对象网关 Swift API</a></li>
      <li class="breadcrumb-item active">Container Operations</li>
      <li class="wy-breadcrumbs-aside">
            <a href="../../../_sources/radosgw/swift/containerops.rst.txt" rel="nofollow"> View page source</a>
      </li>
  </ul>
  <hr/>
</div>
  </header>
  <div class="wy-grid-for-nav">
    
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search"  style="background: #eee" >
          

          
            <a href="../../../" class="icon icon-home"> Ceph
          

          
          </a>

          

          
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="../../../search/" method="get">
    <input type="text" name="q" placeholder="Search docs" aria-label="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>

          
        </div>

        
        <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
          
            
            
              
            
            
              <ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../../../start/">Ceph 简介</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../install/">安装 Ceph</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../cephadm/">Cephadm</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../rados/">Ceph 存储集群</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../cephfs/">Ceph 文件系统</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../rbd/">Ceph 块设备</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="../../">Ceph 对象网关</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="../../frontends/">HTTP 前端</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../multisite/">多站配置</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../zone-features/">域的功能</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../placement/">存储池归置与存储类</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../multisite-sync-policy/">多站同步策略配置</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../pools/">存储池的配置</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../config-ref/">配置参考</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../admin/">管理指南</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../account/">用户账户</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../s3/">S3 API</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../iam/">IAM API</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../rgw-cache/">数据缓存和 CDN</a></li>
<li class="toctree-l2 current"><a class="reference internal" href="../">Swift API</a><ul class="current">
<li class="toctree-l3 current"><a class="reference internal" href="../#api">API</a><ul class="current">
<li class="toctree-l4"><a class="reference internal" href="../auth/">认证</a></li>
<li class="toctree-l4"><a class="reference internal" href="../serviceops/">服务操作</a></li>
<li class="toctree-l4 current"><a class="current reference internal" href="#">容器操作</a></li>
<li class="toctree-l4"><a class="reference internal" href="../objectops/">对象操作</a></li>
<li class="toctree-l4"><a class="reference internal" href="../tempurl/">临时 URL 操作</a></li>
<li class="toctree-l4"><a class="reference internal" href="../tutorial/">指导手册</a></li>
<li class="toctree-l4"><a class="reference internal" href="../java/">Java</a></li>
<li class="toctree-l4"><a class="reference internal" href="../python/">Python</a></li>
<li class="toctree-l4"><a class="reference internal" href="../ruby/">Ruby</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="../#id1">功能支持</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../../adminops/">管理操作 API</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../api/">Python 接口</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../nfs/">通过 NFS 导出</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../keystone/">与 OpenStack Keystone 对接</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../barbican/">与 OpenStack Barbican 对接</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../vault/">与 HashiCorp Vault 对接</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../kmip/">与 KMIP 对接</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../opa/">与 Open Policy Agent 对接</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../multitenancy/">多租户</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../compression/">压缩</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../ldap-auth/">LDAP 认证</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../encryption/">服务器端加密</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../bucketpolicy/">桶策略</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../dynamicresharding/">动态的桶索引重分片</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../mfa/">多因子认证</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../sync-modules/">同步模块</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../notifications/">Bucket Notifications</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../layout/">RADOS 中的数据布局</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../STS/">STS</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../STSLite/">STS Lite</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../keycloak/">Keycloak</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../session-tags/">Session Tags</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../role/">Role</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../orphans/">Orphan List and Associated Tooliing</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../oidc/">OpenID Connect Provider</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../troubleshooting/">故障排除</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../../man/8/radosgw/">radosgw 手册页</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../../man/8/radosgw-admin/">radosgw-admin 手册页</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../qat-accel/">使用 QAT 为加密和压缩提速</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../s3select/">S3-select</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../lua-scripting/">Lua Scripting</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../d3n_datacache/">D3N Data Cache</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../cloud-transition/">Cloud Transition</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../metrics/">Metrics</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../uadk-accel/">UADK Acceleration for Compression</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../bucket_logging/">桶的日志记录</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../../../mgr/">Ceph 管理器守护进程</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../mgr/dashboard/">Ceph 仪表盘</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../monitoring/">监控概览</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../api/">API 文档</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../architecture/">体系结构</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../dev/developer_guide/">开发者指南</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../dev/internals/">Ceph 内幕</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../governance/">项目管理</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../foundation/">Ceph 基金会</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../ceph-volume/">ceph-volume</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../releases/general/">Ceph 版本（总目录）</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../releases/">Ceph 版本（索引）</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../security/">Security</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../hardware-monitoring/">硬件监控</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../glossary/">Ceph 术语</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../jaegertracing/">Tracing</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../translation_cn/">中文版翻译资源</a></li>
</ul>

            
          
        </div>
        
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">

      
      <nav class="wy-nav-top" aria-label="top navigation">
        
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="../../../">Ceph</a>
        
      </nav>


      <div class="wy-nav-content">
        
        <div class="rst-content">
        
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
            
<div id="dev-warning" class="admonition note">
  <p class="first admonition-title">Notice</p>
  <p class="last">This document is for a development version of Ceph.</p>
</div>
  <div id="docubetter" align="right" style="padding: 5px; font-weight: bold;">
    <a href="https://pad.ceph.com/p/Report_Documentation_Bugs">Report a Documentation Bug</a>
  </div>

  
  <section id="container-operations">
<h1>Container Operations<a class="headerlink" href="#container-operations" title="Permalink to this heading"></a></h1>
<p>A container is a mechanism for storing data objects. An account may
have many containers, but container names must be unique. This API enables a
client to create a container, set access controls and metadata,
retrieve a container’s contents, and delete a container. Since this API
makes requests related to information in a particular user’s account, all
requests in this API must be authenticated unless a container’s access control
is deliberately made publicly accessible (i.e., allows anonymous requests).</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>The Amazon S3 API uses the term ‘bucket’ to describe a data container.
When you hear someone refer to a ‘bucket’ within the Swift API, the term
‘bucket’ may be construed as the equivalent of the term ‘container.’</p>
</div>
<p>One facet of object storage is that it does not support hierarchical paths
or directories. Instead, it supports one level consisting of one or more
containers, where each container may have objects. The RADOS Gateway’s
Swift-compatible API supports the notion of ‘pseudo-hierarchical containers,’
which is a means of using object naming to emulate a container (or directory)
hierarchy without actually implementing one in the storage system. You may
name objects with pseudo-hierarchical names
(e.g., photos/buildings/empire-state.jpg), but container names cannot
contain a forward slash (<code class="docutils literal notranslate"><span class="pre">/</span></code>) character.</p>
<section id="create-a-container">
<h2>Create a Container<a class="headerlink" href="#create-a-container" title="Permalink to this heading"></a></h2>
<p>To create a new container, make a <code class="docutils literal notranslate"><span class="pre">PUT</span></code> request with the API version, account,
and the name of the new container. The container name must be unique, must not
contain a forward-slash (/) character, and should be less than 256 bytes. You
may include access control headers and metadata headers in the request. The
operation is idempotent; that is, if you make a request to create a container
that already exists, it will return with a HTTP 202 return code, but will not
create another container.</p>
<section id="syntax">
<h3>Syntax<a class="headerlink" href="#syntax" title="Permalink to this heading"></a></h3>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">PUT</span> <span class="o">/</span><span class="p">{</span><span class="n">api</span> <span class="n">version</span><span class="p">}</span><span class="o">/</span><span class="p">{</span><span class="n">account</span><span class="p">}</span><span class="o">/</span><span class="p">{</span><span class="n">container</span><span class="p">}</span> <span class="n">HTTP</span><span class="o">/</span><span class="mf">1.1</span>
<span class="n">Host</span><span class="p">:</span> <span class="p">{</span><span class="n">fqdn</span><span class="p">}</span>
<span class="n">X</span><span class="o">-</span><span class="n">Auth</span><span class="o">-</span><span class="n">Token</span><span class="p">:</span> <span class="p">{</span><span class="n">auth</span><span class="o">-</span><span class="n">token</span><span class="p">}</span>
<span class="n">X</span><span class="o">-</span><span class="n">Container</span><span class="o">-</span><span class="n">Read</span><span class="p">:</span> <span class="p">{</span><span class="n">comma</span><span class="o">-</span><span class="n">separated</span><span class="o">-</span><span class="n">uids</span><span class="p">}</span>
<span class="n">X</span><span class="o">-</span><span class="n">Container</span><span class="o">-</span><span class="n">Write</span><span class="p">:</span> <span class="p">{</span><span class="n">comma</span><span class="o">-</span><span class="n">separated</span><span class="o">-</span><span class="n">uids</span><span class="p">}</span>
<span class="n">X</span><span class="o">-</span><span class="n">Container</span><span class="o">-</span><span class="n">Meta</span><span class="o">-</span><span class="p">{</span><span class="n">key</span><span class="p">}:</span> <span class="p">{</span><span class="n">value</span><span class="p">}</span>
</pre></div>
</div>
</section>
<section id="headers">
<h3>Headers<a class="headerlink" href="#headers" title="Permalink to this heading"></a></h3>
<p><code class="docutils literal notranslate"><span class="pre">X-Container-Read</span></code></p>
<dl class="field-list simple">
<dt class="field-odd">Description<span class="colon">:</span></dt>
<dd class="field-odd"><p>The user IDs with read permissions for the container.</p>
</dd>
<dt class="field-even">Type<span class="colon">:</span></dt>
<dd class="field-even"><p>Comma-separated string values of user IDs.</p>
</dd>
<dt class="field-odd">Required<span class="colon">:</span></dt>
<dd class="field-odd"><p>No</p>
</dd>
</dl>
<p><code class="docutils literal notranslate"><span class="pre">X-Container-Write</span></code></p>
<dl class="field-list simple">
<dt class="field-odd">Description<span class="colon">:</span></dt>
<dd class="field-odd"><p>The user IDs with write permissions for the container.</p>
</dd>
<dt class="field-even">Type<span class="colon">:</span></dt>
<dd class="field-even"><p>Comma-separated string values of user IDs.</p>
</dd>
<dt class="field-odd">Required<span class="colon">:</span></dt>
<dd class="field-odd"><p>No</p>
</dd>
</dl>
<p><code class="docutils literal notranslate"><span class="pre">X-Container-Meta-{key}</span></code></p>
<dl class="field-list simple">
<dt class="field-odd">Description<span class="colon">:</span></dt>
<dd class="field-odd"><p>A user-defined meta data key that takes an arbitrary string value.</p>
</dd>
<dt class="field-even">Type<span class="colon">:</span></dt>
<dd class="field-even"><p>String</p>
</dd>
<dt class="field-odd">Required<span class="colon">:</span></dt>
<dd class="field-odd"><p>No</p>
</dd>
</dl>
</section>
<section id="http-response">
<h3>HTTP Response<a class="headerlink" href="#http-response" title="Permalink to this heading"></a></h3>
<p>If a container with the same name already exists, and the user is the
container owner then the operation will succeed. Otherwise the operation
will fail.</p>
<p><code class="docutils literal notranslate"><span class="pre">409</span></code></p>
<dl class="field-list simple">
<dt class="field-odd">Description<span class="colon">:</span></dt>
<dd class="field-odd"><p>The container already exists under a different user’s ownership.</p>
</dd>
<dt class="field-even">Status Code<span class="colon">:</span></dt>
<dd class="field-even"><p><code class="docutils literal notranslate"><span class="pre">BucketAlreadyExists</span></code></p>
</dd>
</dl>
</section>
</section>
<section id="list-a-container-s-objects">
<h2>List a Container’s Objects<a class="headerlink" href="#list-a-container-s-objects" title="Permalink to this heading"></a></h2>
<p>To list the objects within a container, make a <code class="docutils literal notranslate"><span class="pre">GET</span></code> request with the
API version, account, and the name of the container.  You can specify query
parameters to filter the full list, or leave out the parameters to return a list
of the first 10,000 object names stored in the container.</p>
<section id="id1">
<h3>Syntax<a class="headerlink" href="#id1" title="Permalink to this heading"></a></h3>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">GET</span> <span class="o">/</span><span class="p">{</span><span class="n">api</span> <span class="n">version</span><span class="p">}</span><span class="o">/</span><span class="p">{</span><span class="n">container</span><span class="p">}</span> <span class="n">HTTP</span><span class="o">/</span><span class="mf">1.1</span>
     <span class="n">Host</span><span class="p">:</span> <span class="p">{</span><span class="n">fqdn</span><span class="p">}</span>
     <span class="n">X</span><span class="o">-</span><span class="n">Auth</span><span class="o">-</span><span class="n">Token</span><span class="p">:</span> <span class="p">{</span><span class="n">auth</span><span class="o">-</span><span class="n">token</span><span class="p">}</span>
</pre></div>
</div>
</section>
<section id="parameters">
<h3>Parameters<a class="headerlink" href="#parameters" title="Permalink to this heading"></a></h3>
<p><code class="docutils literal notranslate"><span class="pre">format</span></code></p>
<dl class="field-list simple">
<dt class="field-odd">Description<span class="colon">:</span></dt>
<dd class="field-odd"><p>Defines the format of the result.</p>
</dd>
<dt class="field-even">Type<span class="colon">:</span></dt>
<dd class="field-even"><p>String</p>
</dd>
<dt class="field-odd">Valid Values<span class="colon">:</span></dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">json</span></code> | <code class="docutils literal notranslate"><span class="pre">xml</span></code></p>
</dd>
<dt class="field-even">Required<span class="colon">:</span></dt>
<dd class="field-even"><p>No</p>
</dd>
</dl>
<p><code class="docutils literal notranslate"><span class="pre">prefix</span></code></p>
<dl class="field-list simple">
<dt class="field-odd">Description<span class="colon">:</span></dt>
<dd class="field-odd"><p>Limits the result set to objects beginning with the specified prefix.</p>
</dd>
<dt class="field-even">Type<span class="colon">:</span></dt>
<dd class="field-even"><p>String</p>
</dd>
<dt class="field-odd">Required<span class="colon">:</span></dt>
<dd class="field-odd"><p>No</p>
</dd>
</dl>
<p><code class="docutils literal notranslate"><span class="pre">marker</span></code></p>
<dl class="field-list simple">
<dt class="field-odd">Description<span class="colon">:</span></dt>
<dd class="field-odd"><p>Returns a list of results greater than the marker value.</p>
</dd>
<dt class="field-even">Type<span class="colon">:</span></dt>
<dd class="field-even"><p>String</p>
</dd>
<dt class="field-odd">Required<span class="colon">:</span></dt>
<dd class="field-odd"><p>No</p>
</dd>
</dl>
<p><code class="docutils literal notranslate"><span class="pre">limit</span></code></p>
<dl class="field-list simple">
<dt class="field-odd">Description<span class="colon">:</span></dt>
<dd class="field-odd"><p>Limits the number of results to the specified value.</p>
</dd>
<dt class="field-even">Type<span class="colon">:</span></dt>
<dd class="field-even"><p>Integer</p>
</dd>
<dt class="field-odd">Valid Range<span class="colon">:</span></dt>
<dd class="field-odd"><p>0 - 10,000</p>
</dd>
<dt class="field-even">Required<span class="colon">:</span></dt>
<dd class="field-even"><p>No</p>
</dd>
</dl>
<p><code class="docutils literal notranslate"><span class="pre">delimiter</span></code></p>
<dl class="field-list simple">
<dt class="field-odd">Description<span class="colon">:</span></dt>
<dd class="field-odd"><p>The delimiter between the prefix and the rest of the object name.</p>
</dd>
<dt class="field-even">Type<span class="colon">:</span></dt>
<dd class="field-even"><p>String</p>
</dd>
<dt class="field-odd">Required<span class="colon">:</span></dt>
<dd class="field-odd"><p>No</p>
</dd>
</dl>
<p><code class="docutils literal notranslate"><span class="pre">path</span></code></p>
<dl class="field-list simple">
<dt class="field-odd">Description<span class="colon">:</span></dt>
<dd class="field-odd"><p>The pseudo-hierarchical path of the objects.</p>
</dd>
<dt class="field-even">Type<span class="colon">:</span></dt>
<dd class="field-even"><p>String</p>
</dd>
<dt class="field-odd">Required<span class="colon">:</span></dt>
<dd class="field-odd"><p>No</p>
</dd>
</dl>
<p><code class="docutils literal notranslate"><span class="pre">allow_unordered</span></code></p>
<dl class="field-list simple">
<dt class="field-odd">Description<span class="colon">:</span></dt>
<dd class="field-odd"><p>Allows the results to be returned unordered to reduce computation overhead. Cannot be used with <code class="docutils literal notranslate"><span class="pre">delimiter</span></code>.</p>
</dd>
<dt class="field-even">Type<span class="colon">:</span></dt>
<dd class="field-even"><p>Boolean</p>
</dd>
<dt class="field-odd">Required<span class="colon">:</span></dt>
<dd class="field-odd"><p>No</p>
</dd>
<dt class="field-even">Non-Standard Extension<span class="colon">:</span></dt>
<dd class="field-even"><p>Yes</p>
</dd>
</dl>
</section>
<section id="response-entities">
<h3>Response Entities<a class="headerlink" href="#response-entities" title="Permalink to this heading"></a></h3>
<p><code class="docutils literal notranslate"><span class="pre">container</span></code></p>
<dl class="field-list simple">
<dt class="field-odd">Description<span class="colon">:</span></dt>
<dd class="field-odd"><p>The container.</p>
</dd>
<dt class="field-even">Type<span class="colon">:</span></dt>
<dd class="field-even"><p>Container</p>
</dd>
</dl>
<p><code class="docutils literal notranslate"><span class="pre">object</span></code></p>
<dl class="field-list simple">
<dt class="field-odd">Description<span class="colon">:</span></dt>
<dd class="field-odd"><p>An object within the container.</p>
</dd>
<dt class="field-even">Type<span class="colon">:</span></dt>
<dd class="field-even"><p>Container</p>
</dd>
</dl>
<p><code class="docutils literal notranslate"><span class="pre">name</span></code></p>
<dl class="field-list simple">
<dt class="field-odd">Description<span class="colon">:</span></dt>
<dd class="field-odd"><p>The name of an object within the container.</p>
</dd>
<dt class="field-even">Type<span class="colon">:</span></dt>
<dd class="field-even"><p>String</p>
</dd>
</dl>
<p><code class="docutils literal notranslate"><span class="pre">hash</span></code></p>
<dl class="field-list simple">
<dt class="field-odd">Description<span class="colon">:</span></dt>
<dd class="field-odd"><p>A hash code of the object’s contents.</p>
</dd>
<dt class="field-even">Type<span class="colon">:</span></dt>
<dd class="field-even"><p>String</p>
</dd>
</dl>
<p><code class="docutils literal notranslate"><span class="pre">last_modified</span></code></p>
<dl class="field-list simple">
<dt class="field-odd">Description<span class="colon">:</span></dt>
<dd class="field-odd"><p>The last time the object’s contents were modified.</p>
</dd>
<dt class="field-even">Type<span class="colon">:</span></dt>
<dd class="field-even"><p>Date</p>
</dd>
</dl>
<p><code class="docutils literal notranslate"><span class="pre">content_type</span></code></p>
<dl class="field-list simple">
<dt class="field-odd">Description<span class="colon">:</span></dt>
<dd class="field-odd"><p>The type of content within the object.</p>
</dd>
<dt class="field-even">Type<span class="colon">:</span></dt>
<dd class="field-even"><p>String</p>
</dd>
</dl>
</section>
</section>
<section id="update-a-container-s-acls">
<h2>Update a Container’s ACLs<a class="headerlink" href="#update-a-container-s-acls" title="Permalink to this heading"></a></h2>
<p>When a user creates a container, the user has read and write access to the
container by default. To allow other users to read a container’s contents or
write to a container, you must specifically enable the user.
You may also specify <code class="docutils literal notranslate"><span class="pre">*</span></code> in the <code class="docutils literal notranslate"><span class="pre">X-Container-Read</span></code> or <code class="docutils literal notranslate"><span class="pre">X-Container-Write</span></code>
settings, which effectively enables all users to either read from or write
to the container. Setting <code class="docutils literal notranslate"><span class="pre">*</span></code> makes the container public. That is it
enables anonymous users to either read from or write to the container.</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>If you are planning to expose public read ACL functionality
for the Swift API, it is strongly recommended to include the
Swift account name in the endpoint definition, so as to most
closely emulate the behavior of native OpenStack Swift. To
do so, set the <code class="docutils literal notranslate"><span class="pre">ceph.conf</span></code> configuration option <code class="docutils literal notranslate"><span class="pre">rgw</span>
<span class="pre">swift</span> <span class="pre">account</span> <span class="pre">in</span> <span class="pre">url</span> <span class="pre">=</span> <span class="pre">true</span></code>, and update your Keystone
endpoint to the URL suffix <code class="docutils literal notranslate"><span class="pre">/v1/AUTH_%(tenant_id)s</span></code>
(instead of just <code class="docutils literal notranslate"><span class="pre">/v1</span></code>).</p>
</div>
<section id="id2">
<h3>Syntax<a class="headerlink" href="#id2" title="Permalink to this heading"></a></h3>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">POST</span> <span class="o">/</span><span class="p">{</span><span class="n">api</span> <span class="n">version</span><span class="p">}</span><span class="o">/</span><span class="p">{</span><span class="n">account</span><span class="p">}</span><span class="o">/</span><span class="p">{</span><span class="n">container</span><span class="p">}</span> <span class="n">HTTP</span><span class="o">/</span><span class="mf">1.1</span>
<span class="n">Host</span><span class="p">:</span> <span class="p">{</span><span class="n">fqdn</span><span class="p">}</span>
     <span class="n">X</span><span class="o">-</span><span class="n">Auth</span><span class="o">-</span><span class="n">Token</span><span class="p">:</span> <span class="p">{</span><span class="n">auth</span><span class="o">-</span><span class="n">token</span><span class="p">}</span>
     <span class="n">X</span><span class="o">-</span><span class="n">Container</span><span class="o">-</span><span class="n">Read</span><span class="p">:</span> <span class="o">*</span>
     <span class="n">X</span><span class="o">-</span><span class="n">Container</span><span class="o">-</span><span class="n">Write</span><span class="p">:</span> <span class="p">{</span><span class="n">uid1</span><span class="p">},</span> <span class="p">{</span><span class="n">uid2</span><span class="p">},</span> <span class="p">{</span><span class="n">uid3</span><span class="p">}</span>
</pre></div>
</div>
</section>
<section id="request-headers">
<h3>Request Headers<a class="headerlink" href="#request-headers" title="Permalink to this heading"></a></h3>
<p><code class="docutils literal notranslate"><span class="pre">X-Container-Read</span></code></p>
<dl class="field-list simple">
<dt class="field-odd">Description<span class="colon">:</span></dt>
<dd class="field-odd"><p>The user IDs with read permissions for the container.</p>
</dd>
<dt class="field-even">Type<span class="colon">:</span></dt>
<dd class="field-even"><p>Comma-separated string values of user IDs.</p>
</dd>
<dt class="field-odd">Required<span class="colon">:</span></dt>
<dd class="field-odd"><p>No</p>
</dd>
</dl>
<p><code class="docutils literal notranslate"><span class="pre">X-Container-Write</span></code></p>
<dl class="field-list simple">
<dt class="field-odd">Description<span class="colon">:</span></dt>
<dd class="field-odd"><p>The user IDs with write permissions for the container.</p>
</dd>
<dt class="field-even">Type<span class="colon">:</span></dt>
<dd class="field-even"><p>Comma-separated string values of user IDs.</p>
</dd>
<dt class="field-odd">Required<span class="colon">:</span></dt>
<dd class="field-odd"><p>No</p>
</dd>
</dl>
</section>
</section>
<section id="add-update-container-metadata">
<h2>Add/Update Container Metadata<a class="headerlink" href="#add-update-container-metadata" title="Permalink to this heading"></a></h2>
<p>To add metadata to a container, make a <code class="docutils literal notranslate"><span class="pre">POST</span></code> request with the API version,
account, and container name. You must have write permissions on the
container to add or update metadata.</p>
<section id="id3">
<h3>Syntax<a class="headerlink" href="#id3" title="Permalink to this heading"></a></h3>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">POST</span> <span class="o">/</span><span class="p">{</span><span class="n">api</span> <span class="n">version</span><span class="p">}</span><span class="o">/</span><span class="p">{</span><span class="n">account</span><span class="p">}</span><span class="o">/</span><span class="p">{</span><span class="n">container</span><span class="p">}</span> <span class="n">HTTP</span><span class="o">/</span><span class="mf">1.1</span>
<span class="n">Host</span><span class="p">:</span> <span class="p">{</span><span class="n">fqdn</span><span class="p">}</span>
     <span class="n">X</span><span class="o">-</span><span class="n">Auth</span><span class="o">-</span><span class="n">Token</span><span class="p">:</span> <span class="p">{</span><span class="n">auth</span><span class="o">-</span><span class="n">token</span><span class="p">}</span>
     <span class="n">X</span><span class="o">-</span><span class="n">Container</span><span class="o">-</span><span class="n">Meta</span><span class="o">-</span><span class="n">Color</span><span class="p">:</span> <span class="n">red</span>
     <span class="n">X</span><span class="o">-</span><span class="n">Container</span><span class="o">-</span><span class="n">Meta</span><span class="o">-</span><span class="n">Taste</span><span class="p">:</span> <span class="n">salty</span>
</pre></div>
</div>
</section>
<section id="id4">
<h3>Request Headers<a class="headerlink" href="#id4" title="Permalink to this heading"></a></h3>
<p><code class="docutils literal notranslate"><span class="pre">X-Container-Meta-{key}</span></code></p>
<dl class="field-list simple">
<dt class="field-odd">Description<span class="colon">:</span></dt>
<dd class="field-odd"><p>A user-defined meta data key that takes an arbitrary string value.</p>
</dd>
<dt class="field-even">Type<span class="colon">:</span></dt>
<dd class="field-even"><p>String</p>
</dd>
<dt class="field-odd">Required<span class="colon">:</span></dt>
<dd class="field-odd"><p>No</p>
</dd>
</dl>
</section>
</section>
<section id="enable-object-versioning-for-a-container">
<h2>Enable Object Versioning for a Container<a class="headerlink" href="#enable-object-versioning-for-a-container" title="Permalink to this heading"></a></h2>
<p>To enable object versioning a container, make a <code class="docutils literal notranslate"><span class="pre">POST</span></code> request with
the API version, account, and container name. You must have write
permissions on the container to add or update metadata.</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>Object versioning support is not enabled in radosgw by
default; you must set <code class="docutils literal notranslate"><span class="pre">rgw</span> <span class="pre">swift</span> <span class="pre">versioning</span> <span class="pre">enabled</span> <span class="pre">=</span>
<span class="pre">true</span></code> in <code class="docutils literal notranslate"><span class="pre">ceph.conf</span></code> to enable this feature.</p>
</div>
<section id="id5">
<h3>Syntax<a class="headerlink" href="#id5" title="Permalink to this heading"></a></h3>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">POST</span> <span class="o">/</span><span class="p">{</span><span class="n">api</span> <span class="n">version</span><span class="p">}</span><span class="o">/</span><span class="p">{</span><span class="n">account</span><span class="p">}</span><span class="o">/</span><span class="p">{</span><span class="n">container</span><span class="p">}</span> <span class="n">HTTP</span><span class="o">/</span><span class="mf">1.1</span>
<span class="n">Host</span><span class="p">:</span> <span class="p">{</span><span class="n">fqdn</span><span class="p">}</span>
     <span class="n">X</span><span class="o">-</span><span class="n">Auth</span><span class="o">-</span><span class="n">Token</span><span class="p">:</span> <span class="p">{</span><span class="n">auth</span><span class="o">-</span><span class="n">token</span><span class="p">}</span>
     <span class="n">X</span><span class="o">-</span><span class="n">Versions</span><span class="o">-</span><span class="n">Location</span><span class="p">:</span> <span class="p">{</span><span class="n">archive</span><span class="o">-</span><span class="n">container</span><span class="p">}</span>
</pre></div>
</div>
</section>
<section id="id6">
<h3>Request Headers<a class="headerlink" href="#id6" title="Permalink to this heading"></a></h3>
<p><code class="docutils literal notranslate"><span class="pre">X-Versions-Location</span></code></p>
<dl class="field-list">
<dt class="field-odd">Description<span class="colon">:</span></dt>
<dd class="field-odd"><p>The name of a container (the “archive container”) that
will be used to store versions of the objects in the
container that the <code class="docutils literal notranslate"><span class="pre">POST</span></code> request is made on (the
“current container”). The archive container need not
exist at the time it is being referenced, but once
<code class="docutils literal notranslate"><span class="pre">X-Versions-Location</span></code> is set on the current container,
and object versioning is thus enabled, the archive
container must exist before any further objects are
updated or deleted in the current container.</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p><code class="docutils literal notranslate"><span class="pre">X-Versions-Location</span></code> is the only
versioning-related header that radosgw
interprets. <code class="docutils literal notranslate"><span class="pre">X-History-Location</span></code>, supported
by native OpenStack Swift, is currently not
supported by radosgw.</p>
</div>
</dd>
<dt class="field-even">Type<span class="colon">:</span></dt>
<dd class="field-even"><p>String</p>
</dd>
<dt class="field-odd">Required<span class="colon">:</span></dt>
<dd class="field-odd"><p>No (if this header is passed with an empty value, object
versioning on the current container is disabled, but the
archive container continues to exist.)</p>
</dd>
</dl>
</section>
</section>
<section id="delete-a-container">
<h2>Delete a Container<a class="headerlink" href="#delete-a-container" title="Permalink to this heading"></a></h2>
<p>To delete a container, make a <code class="docutils literal notranslate"><span class="pre">DELETE</span></code> request with the API version, account,
and the name of the container. The container must be empty. If you’d like to check
if the container is empty, execute a <code class="docutils literal notranslate"><span class="pre">HEAD</span></code> request against the container. Once
you have successfully removed the container, you will be able to reuse the container name.</p>
<section id="id7">
<h3>Syntax<a class="headerlink" href="#id7" title="Permalink to this heading"></a></h3>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">DELETE</span> <span class="o">/</span><span class="p">{</span><span class="n">api</span> <span class="n">version</span><span class="p">}</span><span class="o">/</span><span class="p">{</span><span class="n">account</span><span class="p">}</span><span class="o">/</span><span class="p">{</span><span class="n">container</span><span class="p">}</span> <span class="n">HTTP</span><span class="o">/</span><span class="mf">1.1</span>
<span class="n">Host</span><span class="p">:</span> <span class="p">{</span><span class="n">fqdn</span><span class="p">}</span>
<span class="n">X</span><span class="o">-</span><span class="n">Auth</span><span class="o">-</span><span class="n">Token</span><span class="p">:</span> <span class="p">{</span><span class="n">auth</span><span class="o">-</span><span class="n">token</span><span class="p">}</span>
</pre></div>
</div>
</section>
<section id="id8">
<h3>HTTP Response<a class="headerlink" href="#id8" title="Permalink to this heading"></a></h3>
<p><code class="docutils literal notranslate"><span class="pre">204</span></code></p>
<dl class="field-list simple">
<dt class="field-odd">Description<span class="colon">:</span></dt>
<dd class="field-odd"><p>The container was removed.</p>
</dd>
<dt class="field-even">Status Code<span class="colon">:</span></dt>
<dd class="field-even"><p><code class="docutils literal notranslate"><span class="pre">NoContent</span></code></p>
</dd>
</dl>
</section>
</section>
</section>



<div id="support-the-ceph-foundation" class="admonition note">
  <p class="first admonition-title">Brought to you by the Ceph Foundation</p>
  <p class="last">The Ceph Documentation is a community resource funded and hosted by the non-profit <a href="https://ceph.io/en/foundation/">Ceph Foundation</a>. If you would like to support this and our other efforts, please consider <a href="https://ceph.io/en/foundation/join/">joining now</a>.</p>
</div>


           </div>
           
          </div>
          <footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
        <a href="../serviceops/" class="btn btn-neutral float-left" title="Service Operations" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
        <a href="../objectops/" class="btn btn-neutral float-right" title="对象操作" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
    </div>

  <hr/>

  <div role="contentinfo">
    <p>&#169; Copyright 2016, Ceph authors and contributors. Licensed under Creative Commons Attribution Share Alike 3.0 (CC-BY-SA-3.0).</p>
  </div>

   

</footer>
        </div>
      </div>

    </section>

  </div>
  

  <script type="text/javascript">
      jQuery(function () {
          SphinxRtdTheme.Navigation.enable(true);
      });
  </script>

  
  
    
   

</body>
</html>